package com.medicine.product.study.clone;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

/**
 * @author lynn
 * @version 1.0
 * @date 2022/2/17
 */
public class PrototypeTest {
    public static void main(String[] args) throws CloneNotSupportedException {
        Realizetype obj1 = new Realizetype();
        Realizetype obj2 = (Realizetype) obj1.clone();
        System.out.println("obj1==obj2?" + (obj1 == obj2));



       Map<String,Integer> map = new HashMap<>();

        String s= "abcdaabc";
        for(int i=0;i<s.length();i++){
            if(!map.containsKey(s.charAt(i)+"")){
                int k = 1;
                for (int j = i + 1; j < s.length(); j++) {
                    if (s.charAt(i) == s.charAt(j)) {
                        ++k;
                    }
                }
                map.put(s.charAt(i)+"",k);
            }
        }

        for(Map.Entry<String, Integer> vo : map.entrySet()){
            vo.getKey();
            vo.getValue();
            System.out.println(vo.getKey()+"  "+vo.getValue());
        }

    }
}
